# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=libsignal-protocol-c
pkgver=2.3.3
pkgrel=1
pkgdesc="Signal Protocol C Library"
arch=(loong64 x86_64)
url="https://github.com/WhisperSystems/libsignal-protocol-c"
license=(GPL3)
depends=(glibc)
makedepends=(cmake)
checkdepends=(check openssl)
source=(${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('c22e7690546e24d46210ca92dd808f17c3102e1344cd2f9a370136a96d22319d')

build() {
  cmake -B build -S ${pkgname}-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON \
    $( ((CHECKFUNC)) && echo -DBUILD_TESTING=1)
  make -C build
}

check() {
  cd build
  make -C tests
  ctest
}

package() {
  make -C build DESTDIR="${pkgdir}" install
}
